{
  Ivanov Nikita
  20/11/2012
  Stupid and Smart Summator
}
program StupidCalc;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  Sts= class
    procedure sum(n:integer); virtual;
  end;

  Sms= class(Sts)
    procedure sum(n:integer); override;
  end;

{ sts }

procedure Sts.sum(n:integer);
var s, i:integer;
begin
  s:=0;
  for i:=1 to n do
    s:=s+i;
  writeln('Stupid variant: ', s);
  readln;
end;

{ sms }

procedure Sms.sum(n: integer);
var s:integer;
begin
  s:= n*(n+1) div 2;
  writeln('Smart variant(Obviosly the same): ', s);
  readln;
end;

var
  sum1: Sts;
  sum2: Sms;
  n:integer;

begin
  sum1:= Sts.Create;
  sum2:= Sms.Create;
  readln(n);
  sum1.sum(n);
  sum2.sum(n);

end.
 